<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:head>
        <title>Add Material</title>
    </h:head>
    <f:view beforePhase="#{UserDisplayManagedBean.doDisplay}">
        <h:body> 
            <p:growl id="growl" showDetail="true"/> 

            <h:form>
                <p:growl id="notif" showDetail="true"/>  
                <p:poll interval="5"   
                        actionListener="#{MessageManagedBean.checkNewMessage}" immediate="true" update="notif" />
                <div id="top" class="top">
                    <h:graphicImage value="/image/newHeader.jpg"/>
                </div>

                <div id="content">                

                    <table >
                        <tr><td>
                                <p:toolbar style="background-color:darkred;font-size:70%;height:25px;width:100%"> 
                                    <p:toolbarGroup align="right">
                                        <p:button title="Home" image="ui-icon-home" outcome ="InventoryDeptWorkspace" />                                  
                                        <p:button title="Notes" image="ui-icon-note" outcome="tasks"/>                                    
                                        <p:button title="Mail" outcome="messages"  image="ui-icon-mail-closed"/>                                   
                                        <p:button title="Edit Preferences" image="ui-icon-gear"/>                                   
                                        <p:button title="Help" image="ui-icon-help"/>
                                        <p:commandButton title="Log Out" immediate="true" type="submit" image="ui-icon-close" actionListener="#{UserManagedBean.doLogout}"/> 
                                    </p:toolbarGroup>
                                </p:toolbar></td>
                            <td>
                                <h:graphicImage value="materials.png" style="width:40px;height:40px" />
                                <h:outputText value="       "/>
                                <h:outputText value="New Material" style="font-size: 20px;font-weight: bolder ;font-family: Tahoma;text-align:left;color: darkblue"/>

                            </td>
                        </tr>
                        <tr>

                            <td style="vertical-align:top">
                                <p:menu style="width:200px;font-size: 12px;font-family: Tahoma;border-style: ridge">  
                                    <p:submenu label="Inventories" > 
                                        <p:menuitem value="New Product" url="http://localhost:8080/MerlionERP-war/SCM/addProduct.xhtml" ajax="false" icon="ui-icon ui-icon-tag"/>  
                                        <p:menuitem value="View All Products" url="http://localhost:8080/MerlionERP-war/SCM/products.xhtml" ajax="false" icon="ui-icon ui-icon-tag"/>  
                                        <p:menuitem value="New Material" url="http://localhost:8080/MerlionERP-war/SCM/addMaterial.xhtml" ajax="false" icon="ui-icon ui-icon-tag"/>                                      
                                        <p:menuitem value="View All Materials" url="http://localhost:8080/MerlionERP-war/SCM/materials.xhtml" ajax="false" icon="ui-icon ui-icon-tag" />
                                        <p:menuitem value="View Unhoused Inventories" url="http://localhost:8080/MerlionERP-war/SCM/unhousedInventories.xhtml" ajax="false" icon="ui-icon ui-icon-tag" />

                                    </p:submenu>
                                    <p:submenu label="Warehouses" >
                                        <p:menuitem value="New Warehouse" url="http://localhost:8080/MerlionERP-war/SCM/addWarehouse.xhtml" ajax="false" icon="ui-icon ui-icon-tag"/>        
                                        <p:menuitem value= "View All Warehouses" url="http://localhost:8080/MerlionERP-war/SCM/warehouses.xhtml" ajax="false" icon="ui-icon ui-icon-tag" />
                                    </p:submenu>
                                    <p:submenu label="Shipments and Orders">
                                        <p:menuitem value="Delivery Orders" url="http://localhost:8080/MerlionERP-war/SCM/deliveryOrders.xhtml" ajax="false" icon="ui-icon ui-icon-tag"/>
                                        <p:menuitem value="Picking Orders" url="http://localhost:8080/MerlionERP-war/SCM/pickingOrders.xhtml" ajax="false" icon="ui-icon ui-icon-tag"/>            
                                    </p:submenu>
                                </p:menu>
                                <p:calendar mode="inline" style="font-size:11px;font-family:Tahoma"/>
                            </td>

                            <td>  
                                <p:panel id="panelForm" style="width: 1050px ;font-family: Tahoma;font-size:14px;border-style:hidden">
                                    <center>


                                        <table style="border: 1px solid lightsteelblue;width: 100%" cellpadding="1px" cellspacing="5px" >
                                            <center>
                                                <tr  style="background-color: lavender;font-family: Tahoma;font-size:16px;font-weight:bolder;text-align:left" >
                                                    <td colspan="3">
                                                        <h:outputText value="Material Information"/> 
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td ><h:outputText value=""/></td>
                                                    <td ><h:outputText value=""/></td>

                                                    <td>
                                                        <h:outputText value="*Required field(s)" style="font-family:Tahoma;font-size:10px;font-weight:bold"/>
                                                    </td>
                                                </tr>


                                                <tr style="font-family:Tahoma;font-size:12px" >
                                                    <td align="right" width="40%" > <h:outputLabel for="MaterialName" value="Material Name" /></td>
                                                    <td width="5%" align="center" ><h:outputText value=": "/></td>
                                                    <td width="55%"><p:inputText id="MaterialName" value="#{MaterialManagedBean.newMaterial.name}"/>
                                                    </td>
                                                </tr>

                                                <tr style="font-family:Tahoma;font-size:12px" >
                                                    <td align="right" > <h:outputText value="Material Description" /></td>
                                                    <td  align="center"><h:outputText value=": "/></td>
                                                    <td><p:inputTextarea style="width: 200px; height:100px" value="#{MaterialManagedBean.newMaterial.description}" /></td>

                                                </tr>
                                                <tr style="font-family:Tahoma;font-size:12px">

                                                    <td align="right" > <h:outputLabel for="ShelfLife" value="Shelf Life" /></td>
                                                    <td  align="center"><h:outputText value=": "/></td>
                                                    <td><p:inputText id="ShelfLife" value="#{MaterialManagedBean.newMaterial.shelfLife}" />

                                                    </td>
                                                </tr>

                                                <tr style="font-family:Tahoma;font-size:12px">
                                                    <td align="right" > <h:outputLabel for="LeadTime" value="Lead Time"/></td>
                                                    <td  align="center"><h:outputText value=": "/></td>
                                                    <td><p:inputText id="LeadTime" value="#{MaterialManagedBean.newMaterial.leadTime}"/>

                                                    </td>

                                                </tr>
                                                <tr style="font-family:Tahoma;font-size:12px">


                                                    <td align="right"> <h:outputLabel value="Lot Size"/></td>
                                                    <td  align="center"><h:outputText value=": "/></td>
                                                    <td><p:inputText value="#{MaterialManagedBean.newMaterial.lotSize}"/>
                                                    </td>

                                                </tr>
                                                <tr style="font-family:Tahoma;font-size:12px">
                                                    <td align="right"> <h:outputLabel value="Lot Size Unit"/></td>
                                                    <td  align="center"><h:outputText value=": "/></td>
                                                    <td><p:inputText value="#{MaterialManagedBean.newMaterial.lotSizeUnit}"/>
                                                    </td>


                                                </tr>


                                                <tr style="font-family:Tahoma;font-size:12px">

                                                    <td align="right"> <h:outputLabel value="In Hand Quantity"/></td>
                                                    <td  align="center"><h:outputText value=": "/></td>
                                                    <td><p:inputText value="#{MaterialManagedBean.newMaterial.inHandQty}"/>
                                                    </td>
                                                </tr>

                                            </center>
                                        </table>

                                        <p:panel style="text-align:right; border-style:hidden">  
                                            <p:commandButton value="Submit" type="submit" onclick="confirmation.show()"/>
                                            <p:commandButton value="Reset" type="reset" /></p:panel>

                                        <p:confirmDialog message="Have you finished filling the form?"  
                                                         showEffect="blind" hideEffect="blind"  
                                                         header="Confirmation" severity="alert" widgetVar="confirmation">  

                                            <p:commandButton value="Yes" ajax="true" immediate="true" update="panelForm" oncomplete="confirmation.hide()"  
                                                             actionListener="#{MaterialManagedBean.addMaterial}" />  
                                            <p:commandButton value="No" onclick="confirmation.hide()" type="button" />   

                                        </p:confirmDialog>  
                                    </center>
                                </p:panel>
                                <p:ajaxStatus style="width:16px;height:16px;">
                                    <f:facet name="start">
                                        <h:graphicImage value="25(2).gif" />
                                    </f:facet>
                                    <f:facet name="complete">
                                        <h:outputText value="" />
                                    </f:facet>
                                </p:ajaxStatus>
                            </td> 
                        </tr>
                    </table>
                </div>
                <div id="bottom" class="bottom">
                    <h:graphicImage value="/image/merlionfooter.jpg"/>
                </div>
            </h:form>
        </h:body>
    </f:view>
</html>



